
package sys.model;

import com.util.DateUtil;

import java.util.Date;
/*
* 存储 信息内容
* */
public class Msg {
    private Integer id;    //id

    private String title;   //  信息标题

    private String content; //  信息内容

    private Date ctime;  //创建时间

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }

    public Date getCtime() {
        return ctime;
    }

    public void setCtime(Date ctime) {
        this.ctime = ctime;
    }

    public String getCtimeToFullString(){
        return DateUtil.DateToFullString(ctime);
    }

    public String getTimeAgo(){
        if(ctime==null)  return DateUtil.testMinutesAgo(new Date());
       else return DateUtil.testMinutesAgo(ctime);
    }

    public String toString() {

        return "信息{" +
                "id=" + id +
                ", 标题='" + title + '\'' +
                ", 内容='" + content + '\'' +
                ", 创建时间='" + getCtimeToFullString() + "'}+\n";
    }

}